OpenRoads Designer CONNECT Edition SDK Help

Create a new model in current DGN file

The new model can be created in dgn file. The below code snippet shows how this can be achieved.

Example


internal bool CreateNewModel()
        {
            DgnModelStatus modelCreationStatus;
            //Seed model
            Bentley.DgnPlatformNET.DgnModel seedModel = null;
            //Get active dgn file
            Bentley.DgnPlatformNET.DgnFile dgnFile = Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnFile();

            //Create new model "SampleModel"
            Bentley.DgnPlatformNET.DgnModel newModel = dgnFile.CreateNewModel(out modelCreationStatus, "SampleModel", DgnModelType.Normal, false, seedModel);
            if (DgnModelStatus.Success != modelCreationStatus)
                return false;

            return true;
        }

To create new Model in the Current DGN File, Use CreateNewModel() API of DgnFile. dgnFile is the active DgnFile object here. Seed model is used to set default model settings, if null the default model will be used as seed. DgnModelType can be of type Normal, Sheet, Drawing or DgnComponentDefinition. The model dimensions can be 2D or 3D. A new model of name " SampleModel" is created here.